<template>
  <basic-container>
    <independent-collection-list
      ref="fillingMachineInterfaceList"
      v-show="promotersType === 'list'"
      @addNew="addNew"
      @editPromoters="editPromoters"
    ></independent-collection-list>
    <independent-collection-add-edit
      v-if="promotersType === 'add' || promotersType === 'edit'"
      @back="handleBack"
      :promotersType="promotersType"
      :promotersForm="promotersForm"
    ></independent-collection-add-edit>
  </basic-container>
</template>
<script>
import independentCollectionAddEdit from "@/views/system/independent-collection-add-edit.vue";
import independentCollectionList from "@/views/system/independent-collection-list.vue";
export default {
  data() {
    return {
      promotersType: "list",
      promotersForm: {},
    };
  },

  components: {
    independentCollectionAddEdit,
    independentCollectionList,
  },
  methods: {
    handleBack() {
      this.promotersType = "list";
      this.$refs.fillingMachineInterfaceList.refresh();
    },
    addNew() {
      this.promotersType = "add";
      this.promotersForm = {};
    },
    editPromoters(row) {
      this.promotersType = "edit";
      this.promotersForm = row;
    },
  },
};
</script>
